<template>
  <div class="app-container home">

    <t-row :gutter="32">
      <t-col :span="6">
        <div style="font-weight: bold;font-size: 20px;">小程序提示语修改</div>
        <div style="padding-top: 12px;width: 100%;">
          <editor v-model="tipText" :min-height="150" />
          <t-button style="margin-top: 12px;" @click="Edit" >提交修改</t-button>
        </div>
      </t-col>
      <t-col :span="6">
        <div style="font-weight: bold;font-size: 20px;">收获地址修改</div>
        <div style="padding-top: 12px;width: 500px;">
          <t-textarea
            style="height: 200px;"
            v-model="addressText"
            tips="输入收获地址信息，多个地址用换行符分隔"
            placeholder="请输入收获地址信息"
            :maxlength="500"
        ></t-textarea>
          <t-button style="margin-top: 12px;" @click="EditAddress" >提交修改</t-button>
        </div>
      </t-col>

    </t-row>


  </div>
</template>

<script setup>
import {getCurrentInstance, ref} from 'vue';
import {
  TipText,
  EditTipText,
    EditAddressText,AddressText
} from '@/api/menu'
const { proxy } = getCurrentInstance();

const tipText = ref('');
const addressText = ref('');


const getTipText = async () => {
  const res = await TipText();
  tipText.value = res.data;
}

const getAddressText = async () => {
  const res = await AddressText();
  addressText.value = res.data;
}


const Edit = async () => {
  await EditTipText({
    value: tipText.value
  });
  proxy.$modal.msgSuccess("修改成功");
}

const EditAddress = async () => {
  await EditAddressText({
    value: addressText.value
  });
  proxy.$modal.msgSuccess("修改成功");
}
getTipText();
getAddressText();
</script>

<style scoped lang="scss">
.home {
  blockquote {
    padding: 10px 20px;
    margin: 0 0 20px;
    font-size: 17.5px;
    border-left: 5px solid #eee;
  }
}

::v-deep .t-textarea__inner{
  height: 200px !important;
}
</style>
